import { extendObservable} from 'mobx'
// state文件中仅存放初始化的model数据，将state数据和action分离，目的是将domain和业务逻辑分离，方便管理
export default class State {
    constructor(state) {
        extendObservable(this, {
            account: {
                firstName: '',
                lastName: '',
            },

            test: 'hello world',

            // computed, 依赖store数据的表达式，看做只读变量
            get fullName() {
                const {firstName, lastName} = this.account;
                if (!firstName && !lastName) {
                    return "Please input your name!";
                } else {
                    return firstName + " " + lastName;
                }
            }

        })
    }
}

